package com.bc.service.deal.MtGox;

import java.io.IOException;

import android.content.Context;

import com.bc.service.GenericService;
import com.bc.service.SimpleRequestListener;
import com.bc.service.deal.BtcCategory;
import com.bc.service.deal.ServiceCategory;
import com.bc.service.deal.MtGox.MtGoxResponse.Data;

public class MtGoxService extends GenericService<MtGoxRequest, MtGoxResponse> implements ServiceCategory{

	public MtGoxService(Context context) {
		super(context);
	}
	
	@Override
	protected void onRequest(int requestCode, MtGoxRequest request) {
		
	}

	@Override
	protected void onResponse(int requestCode, MtGoxRequest request,
			MtGoxResponse response) throws IOException {
		
	}
	
	public String getAllData() {
		return mResponse == null ? "获取失败" : mResponse.toString();
	}

	public String getResult() {
		return mResponse == null ? "" : mResponse.result;
	}
	
	public Data getData() {
		return mResponse == null ? null	: mResponse.data;
	}
	
	public String getItemString() {
		return mResponse == null ? null : mResponse.item;
	}

	@Override
	public void loadBtcData(SimpleRequestListener listener) {
		setRequest(new MtGoxRequest());
		request(REQUEST_CODE_LOAD, listener);
	}

	@Override
	public BtcCategory getServieResponse() {
		return mResponse;
	}

	@Override
	public void cancelLoading() {
		super.cancel();
	}
}
